<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Product filter form base class.
 *
 * @package    wifilez
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseProductFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'product_line_id' => new sfWidgetFormFilterInput(),
      'title'           => new sfWidgetFormFilterInput(),
      'version'         => new sfWidgetFormFilterInput(),
      'artist_id'       => new sfWidgetFormFilterInput(),
      'description'     => new sfWidgetFormFilterInput(),
      'category'        => new sfWidgetFormFilterInput(),
      'product_type_id' => new sfWidgetFormPropelChoice(array('model' => 'ProductType', 'add_empty' => true)),
      'type'            => new sfWidgetFormFilterInput(),
      'weight'          => new sfWidgetFormFilterInput(),
      'created'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'modified'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'release_date'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'publisher_id'    => new sfWidgetFormPropelChoice(array('model' => 'Publisher', 'add_empty' => true, 'key_method' => 'getAccountId')),
      'cost'            => new sfWidgetFormFilterInput(),
      'retail_price'    => new sfWidgetFormFilterInput(),
      'units'           => new sfWidgetFormFilterInput(),
      'in_stock'        => new sfWidgetFormFilterInput(),
      'on_hold'         => new sfWidgetFormFilterInput(),
      'on_hand'         => new sfWidgetFormFilterInput(),
      'status'          => new sfWidgetFormFilterInput(),
      'availability'    => new sfWidgetFormFilterInput(),
      'backorder_date'  => new sfWidgetFormFilterInput(),
      'regcode_script'  => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'product_line_id' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'title'           => new sfValidatorPass(array('required' => false)),
      'version'         => new sfValidatorPass(array('required' => false)),
      'artist_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'description'     => new sfValidatorPass(array('required' => false)),
      'category'        => new sfValidatorPass(array('required' => false)),
      'product_type_id' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ProductType', 'column' => 'product_type_id')),
      'type'            => new sfValidatorPass(array('required' => false)),
      'weight'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'modified'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'release_date'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'publisher_id'    => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Publisher', 'column' => 'account_id')),
      'cost'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'retail_price'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'units'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'in_stock'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'on_hold'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'on_hand'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'status'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'availability'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'backorder_date'  => new sfValidatorPass(array('required' => false)),
      'regcode_script'  => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('product_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Product';
  }

  public function getFields()
  {
    return array(
      'product_id'      => 'Number',
      'product_line_id' => 'Number',
      'title'           => 'Text',
      'version'         => 'Text',
      'artist_id'       => 'Number',
      'description'     => 'Text',
      'category'        => 'Text',
      'product_type_id' => 'ForeignKey',
      'type'            => 'Text',
      'weight'          => 'Number',
      'created'         => 'Date',
      'modified'        => 'Date',
      'release_date'    => 'Date',
      'publisher_id'    => 'ForeignKey',
      'cost'            => 'Number',
      'retail_price'    => 'Number',
      'units'           => 'Number',
      'in_stock'        => 'Number',
      'on_hold'         => 'Number',
      'on_hand'         => 'Number',
      'status'          => 'Number',
      'availability'    => 'Number',
      'backorder_date'  => 'Text',
      'regcode_script'  => 'Text',
    );
  }
}
